<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\DB;
class CreateAdminTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('admin', function (Blueprint $table) {
            $table->id("admin_id");
            $table->timestamps();
            $table->string("user_name")->comment("用户名");
            $table->string("eamil")->comment("邮箱")->nullable();
            $table->string("password")->comment("密码");
            $table->string("ec_salt")->comment("加盐")->nullable();
            $table->integer("last_login")->comment("最后登录时间")->nullable();
            $table->ipAddress("last_ip")->comment("最后登录的ip")->nullable();
            $table->string("nav_list")->comment("权限")->nullable();
            $table->integer("role_id")->comment("角色id")->nullable();
            $table->integer("area")->comment("区id")->nullable();
            $table->integer("dept")->comment("部门id")->nullable();
            $table->integer("location")->comment("外联地id")->nullable();
            $table->boolean("status")->comment("是否在职")->default(true);
        });
        DB::statement("ALTER TABLE `admin` comment'tp用后台管理员'");//表注释
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('admin');
    }
}
